-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Adds Regression Test By Mocking Input #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bigquery/samples/utils.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonparrott has an opinion on this!
input trusts the input and eval it, maybe we should just use raw_input here.
Correct me if I'm wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@waprin is fixing it, and removing get_input all together in favor of directly mocking raw_input.
Adds Regression Test By Mocking Input
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 472561635 Source-Link: googleapis/googleapis@332ecf5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4313d682880fd9d7247291164d4e9d3d5bd9f177 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDMxM2Q2ODI4ODBmZDlkNzI0NzI5MTE2NGQ0ZTlkM2Q1YmQ5ZjE3NyJ9
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 472561635 Source-Link: googleapis/googleapis@332ecf5 Source-Link: googleapis/googleapis-gen@4313d68 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDMxM2Q2ODI4ODBmZDlkNzI0NzI5MTE2NGQ0ZTlkM2Q1YmQ5ZjE3NyJ9
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [google-cloud-scheduler](https://github.com/googleapis/python-scheduler) | major | `==1.3.0` -> `==2.0.0` | --- ### Release Notes <details> <summary>googleapis/python-scheduler</summary> ### [`v2.0.0`](https://github.com/googleapis/python-scheduler/blob/master/CHANGELOG.md#​200-httpswwwgithubcomgoogleapispython-schedulercomparev130v200-2020-08-27) [Compare Source](https://github.com/googleapis/python-scheduler/compare/v1.3.0...v2.0.0) ##### ⚠ BREAKING CHANGES - migrate to microgenerator ([#​29](https://github.com/googleapis/python-scheduler/issues/29)) ##### Features - migrate to microgenerator ([#​29](https://github.com/googleapis/python-scheduler/issues/29)) ([82f66ed](https://github.com/googleapis/python-scheduler/commit/82f66ed9c163b2f6597bf5661469ca9ca1bef741)) ##### Bug Fixes - update retry configs ([#​20](https://github.com/googleapis/python-scheduler/issues/20)) ([7f82c9f](https://github.com/googleapis/python-scheduler/commit/7f82c9ffc292d72907de66bf6d5fa39e38d26085)) </details> --- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-scheduler).
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [google-cloud-scheduler](https://github.com/googleapis/python-scheduler) | major | `==1.3.0` -> `==2.0.0` | --- ### Release Notes <details> <summary>googleapis/python-scheduler</summary> ### [`v2.0.0`](https://github.com/googleapis/python-scheduler/blob/master/CHANGELOG.md#​200-httpswwwgithubcomgoogleapispython-schedulercomparev130v200-2020-08-27) [Compare Source](https://github.com/googleapis/python-scheduler/compare/v1.3.0...v2.0.0) ##### ⚠ BREAKING CHANGES - migrate to microgenerator ([#​29](https://github.com/googleapis/python-scheduler/issues/29)) ##### Features - migrate to microgenerator ([#​29](https://github.com/googleapis/python-scheduler/issues/29)) ([82f66ed](https://github.com/googleapis/python-scheduler/commit/82f66ed9c163b2f6597bf5661469ca9ca1bef741)) ##### Bug Fixes - update retry configs ([#​20](https://github.com/googleapis/python-scheduler/issues/20)) ([7f82c9f](https://github.com/googleapis/python-scheduler/commit/7f82c9ffc292d72907de66bf6d5fa39e38d26085)) </details> --- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-scheduler).
* feat: add `time` and `date` dtypes Migrated from BigQuery googleapis/python-bigquery#972 * chore: add license headers to __init__.py files * chore: fail samples nox session if python version is missing (#17) * chore(python): Add kokoro configs for python 3.10 samples testing (#26) * feat: rename dbtime and dbdate dtypes to avoid future conflicts with pandas (#32) * docs: add how-to guide and include API reference (#33) * docs: add how-to guide and include API reference * fix indentation * fix types in sample * fix types in sample * chore(samples): Add check for tests in directory (#54) Source-Link: googleapis/synthtool@52aef91 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(python): Noxfile recognizes that tests can live in a folder (#58) Source-Link: googleapis/synthtool@4760d8d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update all dependencies (#68) * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update setup.py Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Tim Swast <[email protected]> * chore: Adding support for pytest-xdist and pytest-parallel (#76) Source-Link: googleapis/synthtool@82f5cb2 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update dependency pytest to v7.1.0 (#80) * chore(deps): update dependency pytest to v7.1.1 (#83) * chore(python): use black==22.3.0 (#96) Source-Link: googleapis/synthtool@6fab84a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe * chore(python): add nox session to sort python imports (#102) Source-Link: googleapis/synthtool@1b71c10 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update dependency pytest to v7.1.2 (#105) * fix: require python 3.7+ (#125) * chore(python): drop python 3.6 Source-Link: googleapis/synthtool@4f89b13 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c * require python 3.7+ in setup.py * remove python 3.6 sample configs * update product documentation in .repo-metadata.json * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * exclude templated readme * require python 3.7+ in setup.py * remove python 3.6 from noxfile * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update README Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]> * chore(deps): update dependency pytest to v7.1.3 (#144) * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]> * chore: detect samples tests in nested directories (#146) Source-Link: googleapis/synthtool@50db768 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e09366bdf0fd9c8976592988390b24d53583dd9f002d476934da43725adbb978 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update dependency pytest to v7.2.0 (#151) * chore(python): drop flake8-import-order in samples noxfile (#156) Source-Link: googleapis/synthtool@6ed3a83 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(python): add support for python 3.11 (#168) Source-Link: googleapis/synthtool@7197a00 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update dependency pytest to v7.2.1 (#170) * chore(deps): update dependency pytest to v7.2.1 * use python 3.11 in prerelease github action workflow * use python 3.11 in compliance github action workflow --------- Co-authored-by: Anthonios Partheniou <[email protected]> * chore(deps): update dependency pytest to v7.2.2 (#174) * chore(deps): update dependency pytest to v7.3.1 (#184) * chore(deps): update dependency pytest to v7.3.2 (#188) Co-authored-by: Anthonios Partheniou <[email protected]> * chore(deps): update dependency pytest to v7.4.0 (#191) Co-authored-by: Anthonios Partheniou <[email protected]> * chore(deps): update all dependencies (#209) * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update all dependencies (#221) * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * feat: Add support for Python 3.12 (#223) * chore(python): Add Python 3.12 Source-Link: googleapis/synthtool@af16e6d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bacc3af03bff793a03add584537b36b5644342931ad989e3ba1171d3bd5399f5 * add constraints file for python 3.12 * remove constraints file for python 3.6 * Add trove classifiers for python 3.11 / 3.12 * update prerelease and compliance workflows to use python 3.12 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]> * chore(deps): update dependency pytest to v7.4.4 (#235) Co-authored-by: Lingqing Gan <[email protected]> * chore(deps): update dependency pytest to v8 (#239) * chore(deps): update dependency pytest to v8 * pin pytest == 7.4.4 for python 3.7 --------- Co-authored-by: Lingqing Gan <[email protected]> * chore(deps): update dependency pytest to v8.0.1 (#243) * chore(deps): update dependency pytest to v8.0.1 * pin pytest version for python==3.7 --------- Co-authored-by: Lingqing Gan <[email protected]> * chore(deps): update dependency pytest to v8.0.2 (#247) * chore(deps): update dependency pytest to v8.0.2 * pin pytest==7.4.4 for python 3.7 --------- Co-authored-by: Lingqing Gan <[email protected]> * chore(deps): update dependency pytest to v8.1.1 (#251) * chore(deps): update dependency pytest to v8.1.1 * pin pytest==7.4.4 for python 3.7 --------- Co-authored-by: Lingqing Gan <[email protected]> * testing: use arbitrary equality for pinned pytest version (#262) * chore: format code files with nox (#281) * chore(deps): update all dependencies (#290) * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * build: use multiScm for Kokoro release builds (#294) Source-Link: googleapis/synthtool@0da1658 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5cddfe2fb5019bbf78335bc55f15bc13e18354a56b3ff46e1834f8e540807f05 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * deps!: Drop support for Python 3.7 and 3.8 (AI Experiment) (#337) * feat: Drop support for Python 3.7 and 3.8 Removes support for Python 3.7 and 3.8, establishing Python 3.9 as the new minimum supported version. This change involves: - Updating `python_requires` and classifiers in `setup.py`. - Modifying Python versions in `noxfile.py` (default, unit tests, system tests) and ensuring constraint file logic remains correct. - Updating the GitHub Actions workflow (`unittest.yml`) matrix, runner, and coverage job version. - Deleting constraint files for Python 3.7 and 3.8 (`testing/constraints-3.7.txt`, `testing/constraints-3.8.txt`). - Removing Kokoro sample configuration directories (`.kokoro/samples/python3.7/`, `.kokoro/samples/python3.8/`). - Updating supported version mentions in `README.rst`. - Removing 3.7 and 3.8 from the `ALL_VERSIONS` list in `samples/snippets/noxfile.py`. * Updates python version in lint.yml * Updates owlbot, removing reference to 3.8 * Updates CONTRIBUTING.rst * updates pytest warnings * Removes test_samples-impl ref to older virtualenv package * Removes references to pandas older than 1.5.0 * Removes pandas older than 1.5 and misc changes * updates pandas in setup.py * more updates related to pandas * still broken * Updates FutureWarning tests to account for unittest coverage * Updates json array type tests to account for unittest coverage * updates python version checks to ensure coverage * update json test for unittest coverage * Update pandas_backports unittests to ensure coverage * Updates per review comments * moves class from version specific compliance file to generic file * Removes weird cut and paste error * fix linting errors * updates import statement to ensure import of JSONArrowType * Revise required github status checks * update linting * temporarily marking a class as no cover * more updates * marked several snippets as pragma no cover * updates linting * Updates constraints and setup.py * migrates class from one time compliance file to another * updating pyarrow version * Updates linting * removes determine all and module reload tests * updates re: ndarrybackedextensionarray * testing blacken as part of owlbot processing using 3.8 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * updates blacken to 3.10 * update python version in lint.yml * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * updates owlbot.py * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * updates owlbot.py * testing lint.yml * testing linting issue * testing linting issue * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * updates lint_setup session * Update noxfile.py --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * test: updates python versions and sets owlbot excludes (#367) * chore(deps): update all dependencies * updates to prevent changes to docs and lint.ymls * updates lint python version to 3.10 * remove comments, update lint python version * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Mend Renovate <[email protected]> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(deps): update dependency pytest to v8.4.1 (#368) * chore(deps): update all dependencies * Update docs.yml * Update lint.yml --------- Co-authored-by: Lingqing Gan <[email protected]> * chore(deps): update all dependencies (#373) * feat: Add support for Python 3.14 (#380) This PR adds Python 3.14 as a supported version, and fixed tests for the new version This PR also adds a dependency bound to pandas, as the [upcoming 3.0.0 version is incompatible](googleapis/python-db-dtypes-pandas#381) * correct header * add noxconfig.py * delete noxfile.py * add * lint --------- Co-authored-by: Tim Swast <[email protected]> Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: WhiteSource Renovate <[email protected]> Co-authored-by: Anthonios Partheniou <[email protected]> Co-authored-by: Chelsea Lin <[email protected]> Co-authored-by: Chalmer Lowe <[email protected]> Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Daniel Sanche <[email protected]>
If someone checked out origin/master and ran the samples, they immediately hit a string concatenation error. While an easy fix, I generally think it's a good idea, if possible, to write a failing test that then passes along with the bug fix. This is slightly awkward when getting user input is involved, but here's a pass at it, let me know what you think.